package myjava.p_classLoader;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**
 * @Auther: cty
 * @Date: 2020/4/14 19:17
 * @Description:
 * @version: 1.0
 */

/**
 * 加密工具类
 * @author 尚学堂高淇 www.sxt.cn
 *
 */
public class EncrptUtil {

    public static void encrpt(String src, String dest){
        FileInputStream fis = null;
        FileOutputStream fos = null;

        try {
            fis = new FileInputStream(src);
            fos = new FileOutputStream(dest);

            int temp = -1;
            while((temp=fis.read())!=-1){
                fos.write(temp^0xff);  //取反操作
            }

        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            try {
                if(fis!=null){
                    fis.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                if(fos!=null){
                    fos.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

}

